<html>
<head>
    @include('v1.common.meta')
    <link rel="stylesheet" href="{{elixir('css/basicdata.css')}}">
</head>
<body>
<div class="yjs-grid">
    <div class="yjs-grid-box">
        <div class="layui-tab">
            @if(Auth::check())
                <div class="layui-container">
                    @if($view==='viewData')
                        {{--查看视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>查看【{{$itemData['mac_code']}}】采集器信息</legend>
                                    <div class="layui-field-box">
                                        <div class="layui-row hidden-tips">
                                            <div class="layui-col-md12">
                                                <blockquote class="layui-elem-quote">
                                                    温馨提示：查看数据时，所有表单项均不可修改。
                                                </blockquote>
                                            </div>
                                        </div>
                                        <div class="layui-form layui-form-pane">
                                            基本信息
                                            <hr class="layui-bg-green">
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">采集器代码</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">采集器编号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['mac_code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">所属变压器</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['transformer_code']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">型号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['model']}}" disabled
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">创建时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['created_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">更新时间</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" value="{{$itemData['updated_at']}}"
                                                                   disabled class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @elseif($view=='addData')
                        {{--新增图文视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>新增采集器</legend>
                                    <div class="layui-field-box">
                                        {{--<div class="layui-row hidden-tips">--}}
                                            {{--<div class="layui-col-md12">--}}
                                                {{--<blockquote class="layui-elem-quote">--}}
                                                    {{--温馨提示：新增数据时，存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，建议您自主编辑维护；--}}
                                                {{--</blockquote>--}}
                                            {{--</div>--}}
                                        {{--</div>--}}
                                        <div class="layui-form layui-form-pane" name="collectorsForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">
                                            <input type="hidden" name="code" value="{{$randomCode}}">
                                            <input type="hidden" name="transformers" value="{{$transformers}}">
                                            {{--基本信息--}}
                                            {{--<hr class="layui-bg-green">--}}
                                            <div class="layui-row">
                                                {{--<div class="layui-col-md6">--}}
                                                    {{--<div class="layui-form-item">--}}
                                                        {{--<label class="layui-form-label">采集器代码</label>--}}
                                                        {{--<div class="layui-input-inline">--}}
                                                            {{--<input type="text" value="{{$randomCode}}" disabled--}}
                                                                   {{--class="layui-input">--}}
                                                        {{--</div>--}}
                                                    {{--</div>--}}
                                                {{--</div>--}}
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">采集器编号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="mac_code" required
                                                                   lay-verify="required|mac_code"
                                                                   placeholder="请输入变压器编号"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">所属变压器</label>
                                                        <div class="layui-input-inline">
                                                            <select id="transformer_code" name="transformer_code"
                                                                    lay-filter="transformerSel" lay-verify="required"
                                                                    lay-search="">
                                                                <option value="">直接选择或搜索选择</option>
                                                                @foreach($transformers as $transformer)
                                                                    <option value="{{$transformer["code"]}}">{{$transformer["model_code"]}}</option>
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">型号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="model"
                                                                   placeholder="请输入型号" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @elseif($view=='editData')
                        {{--编辑图文视图--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <fieldset class="layui-elem-field">
                                    <legend>编辑采集器</legend>
                                    <div class="layui-field-box">
                                        {{--<div class="layui-row hidden-tips">--}}
                                            {{--<div class="layui-col-md12">--}}
                                                {{--<blockquote class="layui-elem-quote">--}}
                                                    {{--温馨提示：编辑数据时，存在"<i class="layui-icon">&#xe605;</i>"标识的表单项，建议您自主编辑维护；--}}
                                                {{--</blockquote>--}}
                                            {{--</div>--}}
                                        {{--</div>--}}
                                        <div class="layui-form layui-form-pane" name="collectorsForm"
                                             action="javascript:;" method="POST">
                                            <input type="hidden" name="viewType" value="{{$view}}">
                                            <input type="hidden" name="code" value="{{$itemData['code']}}">
                                            <input type="hidden" name="collector_code" value="{{$itemData['collector_code']}}">
                                            <input type="hidden" name="transformers" value="{{$transformers}}">
                                            {{--基本信息--}}
                                            {{--<hr class="layui-bg-green">--}}
                                            <div class="layui-row">
                                                {{--<div class="layui-col-md6">--}}
                                                    {{--<div class="layui-form-item">--}}
                                                        {{--<label class="layui-form-label">采集器代码</label>--}}
                                                        {{--<div class="layui-input-inline">--}}
                                                            {{--<input type="text" value="{{$itemData['code']}}" disabled--}}
                                                                   {{--class="layui-input">--}}
                                                        {{--</div>--}}
                                                    {{--</div>--}}
                                                {{--</div>--}}
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">采集器编号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="mac_code" required
                                                                   value="{{$itemData['mac_code']}}"
                                                                   lay-verify="required|mac_code"
                                                                   placeholder="请输入变压器编号"
                                                                   class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">所属变压器</label>
                                                        <div class="layui-input-inline">
                                                            <select id="transformer_code" name="transformer_code"
                                                                    lay-filter="transformerSel" lay-verify="required"
                                                                    lay-search="">
                                                                <option value="">直接选择或搜索选择</option>
                                                                @foreach($transformers as $transformer)
                                                                    @if($itemData['transformer_code']===$transformer['code'])
                                                                        <option value="{{$transformer["code"]}}"
                                                                                selected>{{$transformer["model_code"]}}</option>
                                                                    @else
                                                                        <option value="{{$transformer["code"]}}">{{$transformer["model_code"]}}</option>
                                                                    @endif
                                                                @endforeach
                                                            </select>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md6">
                                                    <div class="layui-form-item">
                                                        <label class="layui-form-label">型号</label>
                                                        <div class="layui-input-inline">
                                                            <input type="text" name="model"
                                                                   value="{{$itemData['model']}}"
                                                                   placeholder="请输入型号" class="layui-input">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="layui-row">
                                                <div class="layui-col-md3">
                                                    {{--隐藏提交--}}
                                                    <button id="toolbarSubmit" type="submit" class="layui-btn"
                                                            lay-filter="toolbarEvent" lay-submit style="display: none;">
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    @else
                        {{--视图类型不正确--}}
                        <div class="layui-row">
                            <div class="layui-col-md12">
                                <blockquote class="layui-elem-quote-error">
                                    友情提示：视图类型不正确，无法支持后续操作。
                                </blockquote>
                            </div>
                        </div>
                    @endif
                </div>
            @else
                <div class="layui-container">
                    <div class="layui-row">
                        <div class="layui-col-md12">
                            <blockquote class="layui-elem-quote-error">
                                友情提示：该功能只面向已成功登录系统，并具有相应权限的用户可用。
                            </blockquote>
                        </div>
                    </div>
                </div>
            @endif
        </div>
    </div>
</div>

@include('v1.common.js')
</body>
<script type="text/html">
    <input type="hidden" id="rspStatus" value="">
    <input type="hidden" id="rspMsg" value="">
</script>
</html>